# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=attr
pkgver=2.5.1
pkgrel=5
pkgdesc="utilities for managing filesystem extended attributes"
options="checkroot !check" # attr.test fails with no error message
url="https://savannah.nongnu.org/projects/attr"
arch="all"
license="LGPL-2.1-or-later"
checkdepends="perl"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc lib$pkgname:libs"
source="https://download.savannah.nongnu.org/releases/attr/attr-$pkgver.tar.gz"

build() {
	OPTIMIZER="$CFLAGS" \
	DEBUG=-DNDEBUG \
	INSTALL_USER=root \
	INSTALL_GROUP=root \
	./configure \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/ \
		--exec-prefix=/ \
		--sbindir=/bin \
		--bindir=/usr/bin \
		--libdir=/lib \
		--libexecdir=/usr/lib \
		--includedir=/usr/include \
		--mandir=/usr/share/man \
		--docdir=/usr/share/doc/attr \
		--datadir=/usr/share \
		--disable-nls
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/lib
	mv "$pkgdir"/lib/pkgconfig "$pkgdir"/usr/lib
}

dev() {
	license="LGPL-2.1-or-later"
	default_dev
}

libs() {
	license="LGPL-2.1-or-later"
	default_libs
}

sha512sums="
8b4c043d61f8f3e0cd098e701181069f51117b85fd6ba18bfe9af77d894ea671232377d4793ffc822e9259ceee6ac71d75732eb93b2830c6cb5d0d918ba2d21b  attr-2.5.1.tar.gz
"
